package com.fauks.ssm.mybatis.bean;

import java.util.Set;

/**
 * 自关联查询
 * 自关联一般写法包括子集集合以及父级，根据角度不同转换子集为多方或一方
 */
public class MNews {
    private Integer id;
    private String names;

    /*一对多所有子集*/
    private Set<MNews> children;

    /*多对一关联父级*/
    private MNews parent;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public String getNames() {
        return names;
    }

    public void setNames(String names) {
        this.names = names;
    }

    public Set<MNews> getChildren() {
        return children;
    }

    public void setChildren(Set<MNews> children) {
        this.children = children;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public MNews getParent() {
        return parent;
    }

    public void setParent(MNews parent) {
        this.parent = parent;
    }

    @Override
    public String toString() {
        return "MNews{" +
                "id=" + id +
                ", names='" + names + '\'' +
                ", parent=" + parent +
                '}';
    }

    /*@Override
    public String toString() {
        return "MNews{" +
                "id=" + id +
                ", names='" + names + '\'' +
                ", children=" + children +
                '}';
    }*/
}
